package com.gome.ocean.service.authority.impl;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.gome.ocean.dao.authority.UserOptLogDAO;
import com.gome.ocean.dao.model.authority.UserOptLogBO;
import com.gome.ocean.service.authority.IUserOptLogService;

/**
 * 用户操作日志 实现
 *
 * @author zhangguoqing
 */
@Service("userOptLogService")
public class UserOptLogServiceImpl implements IUserOptLogService{

	@Autowired
	private UserOptLogDAO userOptLogDao;
	
	@Override
	public boolean insertUserOptLog(UserOptLogBO logBO) {
		try {
			userOptLogDao.saveUserOptLogBO(logBO);
			return true;
		} catch (Exception e) {
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public Page<UserOptLogBO> getUserOptLogAllInfo(Integer pageNum, Integer pageSize, Map<String, Object> map) {
		try {
			if (map.get("email") != null) {
				List<UserOptLogBO> list = userOptLogDao.getAllInfo(new RowBounds(pageNum, pageSize), map);
				if (list!=null) {
					return (Page<UserOptLogBO>) list;
				}
			}
			return null;
			
		} catch (Exception e) {
			e.printStackTrace();
		}
		return null;
	}

}
